package com.etoak.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.etoak.entity.Dict;
import com.etoak.mapper.DictMapper;
import com.etoak.service.DictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author et2108
 * @since 2021-12-11
 */
@Service
public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements DictService {
@Autowired
DictMapper dictMapper;
    @Override
    public List<Dict> queryList(String type) {
        QueryWrapper<Dict>  queryWrapper = new QueryWrapper<>();
        //select  name,value from t_dict  where type = ?  order by sort as
        queryWrapper.select("name","value")
                .eq("type",type)
                .orderByAsc("sort");
        return dictMapper.selectList(queryWrapper);
    }
}
